
<#macro form id="add_form" action="" class="form-horizontal" method="post" autocomplete="off">
	<form id="${id}" <#if action!="">action="${action}"</#if> method="${method}" autocomplete="${autocomplete}" role="form" class="${class}" >
		<#nested>
	</form>
</#macro>
 

<#macro toolbar id="">
	<div id="${id}" class="row toolbar">
		<#nested>
	</div>
</#macro>
<#macro sform id="search_form" action="" class="form-inline" method="get" autocomplete="open">
	<div style='display:inline-block; margin: 0 0 0 10px;'>
		<form id="${id}" action="${action}" method="${method}" autocomplete="${autocomplete}" role="form" class="${class}" >
			<#nested>
		</form>
	</div>
</#macro>

<#macro legend title>
	<div class="t-legend"><strong>${title}</strong></div>
</#macro>
<!--search input text -->
<#macro stext title="" id="" value=""  class="form-control" style="" >
	<div class='form-group'>
		<label class='sr-only' for='to_mail'>${title}</label> 
		<input type='text' value='${value}' class='${class}' id='${id} name='${id}' placeholder='${title}' >
	</div>
</#macro>

<#macro btn_a name  href id="" target="_self" icon="cog" type="default" size="btn-sm">
	<!--a 标签类型按钮--> 
 	<a id="${id}" href="${href}" role="button" target="${target}" class="btn btn-${type} ${size}"><i class="fa fa-${icon}"></i>&nbsp;${name}</a>
</#macro>

<#macro btn_b name onclick id="" icon="cog" type="default" size="btn-sm" style="">
	<!--button 标签类型按钮--> 
 	 <button id="${id}" onclick="${onclick}" type="button" style="${style}" class="btn btn-${type} ${size}"><i class="fa fa-${icon}"></i>&nbsp;${name}</button>
</#macro>

<#macro btn_group name type="default" size="btn-sm">
	<!--button 标签类型按钮--> 
											<div class="btn-group">
												<button type="button"
													class="btn btn-${type} ${size} dropdown-toggle"
													data-toggle="dropdown">
													${name} <span class="caret"></span>
												</button>
												<ul class="dropdown-menu" role="menu">
													<#nested>
												</ul>
											</div>
</#macro>
<#macro btn_group_menu name onclick="">
		<li><a href="javascript:${onclick}">${name}</a></li>
</#macro>

<#macro btn_s name icon="search" type="default" size="btn-sm">
	<!--button 标签类型按钮--> 
 	 <button type="submit" class="btn btn-${type} ${size}"><i class="fa fa-${icon}"></i>&nbsp;${name}</button>
</#macro>

<#macro html>
	<#include "admin/include/inside_header.ftl" >
	<body>
		<#nested>
		<#include  "admin/include/footer.ftl">
	</body>
	</html>
</#macro>

<#macro datagrid datalist  id="" checkType="checkbox" multi="true"  >
	<div style="margin-top: 5px;">
		<table id="table-${id}" class="table table-hover table-condensed table-bordered table-responsive">
			<thead class="datagrid_header">
					<tr>
						<th><input value="checkAll" class="check_all" type="${checkType}"></th>
						<#nested>
						<th>操作</th>
					</tr>
			</thead>
			<#list datalist as data>
				<#nested>
			</#list>
		</table>
	</div>
</#macro>

<#macro container title back="false" icon="list-alt" hackCss="" hackJs="">
	<!--容器--> 
 	<div class="container-fluid">
				<!-- 盒子开始 -->
				<div class="box">
					<div class="box-title clearfix">
							<h3>
								<i class="fa fa-${icon!"list-alt"} fa-fw"></i>${title}
							</h3>
							<#if back==true>
							<a href="javascript:history.back(-1);" class="btn btn-default"><span class="glyphicon glyphicon-chevron-left"></span>&nbsp; 返回</a>
							</#if>
					</div>
					<!--内容-->
					<div class="box-content">
						<#nested>
					</div>
				</div>
	</div>
</#macro>

<#macro pannel>
	<!--容器--> 
 	<div class="container-fluid">
		<div class="row">
			<div class="col-md-12" style="padding-top:10px;">
						<#nested>
			</div>
		</div>
	</div>
</#macro>

<#macro dtbody>
	<!--容器--> 
	<tbody>
	<#nested>
	</tbody>
</#macro>
<#macro dtrow data_id="">
	 <tr onclick="checkDataGridRow('${data_id}');">
	 	<#nested>
	 </tr>
</#macro>
<#macro dtheader checked="true">
	<!--容器--> 
 	<thead class="datagrid_header">
			<tr>
				<#if checked==true >
					<th><input value="checkAll" class="check_all" type="checkbox"></th>
				</#if>
				<#nested>
				<th>操作</th>
			</tr>
	</thead>
</#macro>

<#macro checkbox data_id="" class="">
	<td><input name='SelectedID' id="select_${data_id}" value="${data_id}" type="checkbox"></td>
</#macro>

<#-- 单独的checkbox-->
<#macro check title value id="" defValue="" class="checkbox-inline">
	<label class="${class}"><input type="checkbox"  <#if (defValue)> checked="checked" </#if>  name="${id}" id="${id}" value="${value}"> ${title}</label>
</#macro>

<#-- 单独的datepicker-->
<#macro datepicker help="" value="" id="" class="Wdate" >
	<span>
		<input id="${id}" value="${value}" name="${id}" class="Wdate ${class}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text" readOnly>
		<span>${help}</span>
	</span>
</#macro>
<#-- 单独的横向表单-->
<#macro from_f_line title>
	<div class="form-group">
			<label class="col-sm-2 control-label">${title}</label>
			<div class="col-sm-5"><#nested></div>
	</div>
</#macro>

<#macro column title class="">
	<td class="${class}">${title}</td>
</#macro>

<#macro dt id="">
	<div style="margin-top: 5px;">
		<table id="${id}" class="table table-hover table-condensed table-bordered table-responsive">
			<#nested>
		</table>
	</div>
</#macro>
<#macro textShow title="" id="" value="" class="form-control" style="" help="" >
								<div class="form-group">
                                    <label for="text" class="col-sm-2 control-label">${title}：</label>
                                    <div class="col-sm-5">
                                    	 <p class="form-control-static" id="${id}">${value}</p>
                                    </div>
                                  </div>
</#macro>
<!--input text -->
<#macro text title="" id="" value="" readOnly="false"  class="form-control" style="" help=""  >
								<div class="form-group">
                                    <label for="text" class="col-sm-2 control-label">${title}：</label>
                                    <div class="col-sm-5">
                                       <input type="text" <#if (readOnly=="true") > readonly </#if> style="${style}" class="${class}"  value="${value}" name="${id}" id="${id}" placeholder="请输入${title}">
                                    	<#if help!=""><p class="help-block">${help}</p></#if>
                                    </div>
                                  </div>
</#macro>

<#macro password title="" id="" value=""  readOnly="false" class="form-control" style="" help=""  >
								<div class="form-group">
                                    <label for="text" class="col-sm-2 control-label">${title}：</label>
                                    <div class="col-sm-5">
                                       <input <#if (readOnly=="true") > readonly </#if> type="password" style="${style}" class="${class}"  value="${value}" name="${id}" id="${id}" placeholder="请输入${title}">
                                    	<#if help!=""><p class="help-block">${help}</p></#if>
                                    </div>
                                  </div>
</#macro>

<#-- 编辑器 -->
<#macro editor title="" id="" value="" style="height:400px">
								<div class="form-group">
										<label for="${id}" class="col-sm-2 control-label">${title}：</label>
										<div class="col-sm-5">
											<textarea name="${id}" id="${id}" style="${style}"
												placeholder="请输入内容">${value}</textarea>
										</div>
									</div>
									<script>
										 $(function(){ UE.getEditor('${id}');});
									</script>
</#macro>
<#-- textarea -->
<#macro textarea title="" id="" value="" rows="3" style="height:400px">
								<div class="form-group">
										<label for="${id}" class="col-sm-2 control-label">${title}：</label>
										<div class="col-sm-5">
											<textarea id="${id}" name="${id}" class="form-control"
												rows="${rows}">${value}</textarea>
										</div>
								</div>
</#macro>

<#-- 上传组件 -->
<#macro uploader title="" id="" uploadType="image" value="" help="" style="height:400px">
								<div class="form-group">
										<label for="${id}" class="col-sm-2 control-label">${title}：</label>
										<div class="col-sm-5">
												<input type="hidden"  id="${id}" name="${id}"  value="${value}">
												<input type="hidden" id="${id}-uploader" objName="fileData" uploadType='${uploadType}' value-id="${id}" > 
												<#if help!=""><p class="help-block">${help}</p></#if>
										</div>
								</div>
</#macro>

<!--input submit button -->
<#macro submitBtn title="提交" id="submit_btn" >
				  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button id="${id}" type="submit" class="btn btn-default">${title}</button>
                    </div>
                  </div>
</#macro>

<#macro code defVal datas label="info">
										<#-- 判断传入的数据模型是否为哈希表 -->  
										    <#if datas?is_hash_ex>  
										        <#-- 获取哈希表的key集合 -->  
										        <#local keys=datas?keys/>  
										        <#list keys as key>  
										            <#if key==defVal>  
										                <span class="label label-${label}">${datas[key]}</span> 
										                <#break>
										            </#if>  
										        </#list>
										     <#-- 如果传入的数据模型不是哈希表，则可以当作序列或java.util.List来处理 -->  
											    <#else>  
											        <#list datas as data>  
											            <#-- 通常这个判断是针对数据模型为java.util.List的 -->  
											                <#if defaultValue==data[key]?string>  
											                	<span class="label label-${label}">${data[text]}</span> 
										                		<#break>
											                </#if>  
											        </#list>  
											    </#if> 
</#macro>

<#--  
input select tdoc select2 自定义指令genSelect的参数说明，如下  
id           必填。用于指定<select>的id和name属性值  
datas        必填。用于指定数据模型，可以是序列、哈希表、java.util.List等  
key          选填。用于指定<option>的key和text  
text         选填。同key  
headKey      选填。用于指定所显示的第一个<option>，其具有提示信息的意义  
headText     选填。同headKey  
defaultValue 选填。用于指定默认的<option>  
-->  
<#macro select id datas title="" help=""  key="" text="" disabled="false" defaultValue="" headKey="" formType="horizontal" headText="" labelCss="col-sm-2 control-label" class="form-control" style=""   >
								<div class="form-group">
                                    <label for="${name}" class="${labelCss}">${title}：</label>
                                    <#if (formType=="horizontal")><div class="col-sm-5"></#if>
                                    	<select class="form-control" <#if (disabled=="true") > disabled </#if> id="${id}" name="${id}"> 
                                    		<#-- 判断是否需要显示提示性的<option> -->  
										    <#if headKey!="">  
										        <option value="${headKey}">${headText}</option>  
										    </#if>
										    <#-- 判断传入的数据模型是否为哈希表 -->  
										    <#if datas?is_hash_ex>  
										        <#-- 获取哈希表的key集合 -->  
										        <#local keys=datas?keys/>  
										        <#list keys as key>  
										            <#if key==defaultValue>  
										                <option value="${key}" selected>${datas[key]}</option>  
										            <#else>  
										                <option value="${key}">${datas[key]}</option>  
										            </#if>  
										        </#list>
										     <#-- 如果传入的数据模型不是哈希表，则可以当作序列或java.util.List来处理 -->  
											    <#else>  
											        <#list datas as data>  
											            <#-- 通常这个判断是针对数据模型为java.util.List的 -->  
											            <#if key!="">  
											                <#if defaultValue==data[key]?string>  
											                    <option value="${data[key]}" selected>${data[text]}</option>  
											                <#else>  
											                    <option value="${data[key]}">${data[text]}</option>  
											                </#if>  
											            <#-- 通常这个判断是针对数据模型为序列的 -->  
											            <#else>  
											                <#if defaultValue==data>  
											                    <option value="${data}" selected>${data}</option>  
											                <#else>  
											                    <option value="${data}">${data}</option>  
											                </#if>  
											            </#if>  
											        </#list>  
											    </#if> 
                                    	</select>
                                    	<#if help!=""><p class="help-block">${help}</p></#if>
                					<#if (formType=="horizontal")></div></#if>
                				  </div>	
</#macro>
<!--input ztree select -->
<#macro treeSelect treeData title="" id="" value="" help="点击选择父节点"  class="form-control" style=""  >
								<div class="form-group">
                                    <label for="${id}" class="col-sm-2 control-label">${title}</label>
                                    <div class="col-sm-5" style="position: relative;">
                                    	<input type="hidden" readonly="readonly" class="form-control" value="${value}" name="${id}" id="${id}">
                                    	<div id="${id}_name" class="ztreeSelectWrap" >
                                    		<span id="${id}_select_text" class="select_text"></span>
                                    		<span class="caret arrow"></span>
                                    	</div>
                                    	<p class="help-block">${help}</p>
                                    	<div id="${id}_tree_wrap" class="ztreeDoWrap">
                                    		<div class="zTreeDemoBackground left">
												<ul id="${id}_tree" class="ztree"></ul>
											</div>
                                    	</div>
                					</div>
                				  </div>
                				  
</#macro>


<#macro back_pager objCount pageSize pageNum pageCount>
	<#if (objCount >= pageSize) > 
		<#assign __uri="${currentUrl!''}">
		<#assign __p=pageNum>
		<#if (__p<=pageCount) >
				<#assign pre_page=__p-1>
				<#assign next_page=__p+1>
				<#if (__p>3) >
					<#assign begin_idx=__p-3>
				<#else>
					<#assign begin_idx=1>
				</#if>
				<#assign end_idx=begin_idx+9>
				<#if (end_idx>= pageCount) > <#assign end_idx=pageCount> </#if>
				<ul class="pagination" style="float:right;">
					<#if (__p>1) > <li><a title="第一页" href="${__uri}page=${pre_page}">&laquo;</a></li> </#if>
					<#if (begin_idx>1) > <li><a title="第一页" href="${__uri}">1</a></li> </#if>
					<#list begin_idx..end_idx as idx>
						<#if (idx==__p) > 
							<li title="第${idx}页" class='active'><a href="${__uri}page=${idx}">${idx}</a></li>
						<#else>
							<li><a href="${__uri}page=${idx}">${idx}</a></li>
						</#if>
					</#list>
					<#if (end_idx<pageCount) > <li ><a href="${__uri}page=${pageCount}">${pageCount}</a></li> </#if>
					<#if (__p < pageCount) > <li><a href="${__uri}page=${next_page}">&raquo;</a></li> </#if>
				</ul>
		  </#if>
	</#if>
</#macro>